var arr = [13,2,4,15,23,123,5,2,234,23,634,8,23,567,8,5,4,9];

function quickSock (arr) {
    if (arr.length <= 1) return arr
    let left = []
    let right = []
    let temp = arr.splice(Math.floor(arr.length / 2), 1)[0];;

    for (let i = 0; i < arr.length; i++) {
        if (arr[i] < temp) {
            left.push(arr[i])
        } else {
            right.push(arr[i])
        }
    }
    return quickSock(left).concat([temp], quickSock(right))

}
console.log(quickSock(arr))